
* %%%%%%%%%%%%%%%%%%%%%%%
*    SUMMARY STATS
*       
* %%%%%%%%%%%%%%%%%%%%%%%%


use "AdsEmploymentMerged.dta", clear    


* %%%%%%% Own Traits %%%%%%  
* %%%%%%%%%%%% Table 1, Panel A %%%%%%%%%
* Self
estpost sum numself costasker anyageself asker_age anyreligionself ///
anyethnicityself anylooksself anyforeignself_c anyoccself anyeducself ///
lessthandegself_e genedself_e otheredself_e postgradself_e  ///
engself_e medself_e if askermale==1

matrix f1=e(mean)
matrix list f1

estpost sum numself costasker anyageself asker_age anyreligionself ///
anyethnicityself anylooksself anyforeignself_c anyoccself anyeducself_e ///
lessthandegself_e genedself_e otheredself_e postgradself_e  ///
engself_e medself_e if askermale==0

matrix f0=e(mean)
matrix list f0

estpost ttest numself costasker anyageself asker_age anyreligionself ///
anyethnicityself anylooksself anyforeignself_c anyoccself anyeducself_e ///
lessthandegself_e genedself_e otheredself_e postgradself_e  ///
engself_e medself_e, by(askermale) unequal

estadd matrix f1
estadd matrix f0

esttab 
				
* %%%%%% Demands %%%%%%%%
* %%%%%%%%% Table 1, Panel B %%%%%%%%%%%%%%

* Wanted   
estimates clear
estpost sum numdem costaskee anyagewanted askee_age minage anyreligionwanted ///
anyethnicitywanted anylookswanted anyforeignwanted_c anyoccwanted anyeducwanted  ///
lessthandegwanted_e genedwanted_e otheredwanted_e postgradwanted_e  ///
engwanted_e medwanted_e if askermale==1

matrix f1=e(mean)
matrix list f1

estpost sum numdem costaskee anyagewanted askee_age minage anyreligionwanted ///
anyethnicitywanted anylookswanted anyforeignwanted_c anyoccwanted anyeducwanted  ///
lessthandegwanted_e genedwanted_e otheredwanted_e postgradwanted_e  ///
engwanted_e medwanted_e if askermale==0

matrix f0=e(mean)
matrix list f0

estpost ttest numdem costaskee anyagewanted askee_age minage anyreligionwanted ///
anyethnicitywanted anylookswanted anyforeignwanted_c anyoccwanted anyeducwanted ///
lessthandegwanted_e genedwanted_e otheredwanted_e postgradwanted_e  ///
engwanted_e medwanted_e, by(askermale) unequal

estadd matrix f1
estadd matrix f0

esttab 

* %%%%%%%%%%%%% Ads' Characteristics By Year %%%%%%%%%%%  
* %%%%%%%%%%%%% Figure A4 %%%%%%%%%%%%%%%%%  

* Graph version
cap drop m1 m2 m3 m4 m5 m6 m7 
bys year: egen m1=mean(askermale)
bys year: egen m2=mean(asker_age/100)  //age converted to 0-1 scale
bys year: egen m3=mean(anyreligionself_r)
bys year: egen m4=mean(anyethnicityself_et)
bys year: egen m5=mean(anyforeignself)
bys year: egen m6=mean(anyeducself)
bys year: egen m7=mean(anyoccself)

tw (scatter m1 year, msymbol(diamond) mcolor(none) mlcolor(black)) ///
(scatter m2 year, msymbol(triangle) mcolor(none) mlcolor(black)) ///
(scatter m3 year, msymbol(circle) mcolor(none) mlcolor(black)) ///
(scatter m4 year, msymbol(S) mcolor(none) mlcolor(black)) ///
(scatter m5 year, msymbol(triangle) mcolor(black)) ///
(scatter m6 year, msymbol(V) mcolor(black)) ///
(scatter m7 year, msymbol(X) msize(large) mcolor(black*0.7) ///
	 ytitle("Share") xtitle("Year") ylabel(0(0.1)1) ///
	graphregion(color(white)) plotregion(fcolor(white) lcolor(black))  ///
	legend(order(1 "Male" 2 "Age/100" 3 "Religion" 4 "Ethnicity" 5 "Foreign" 6 "Education" 7 "Occupation")))

graph export 	

tw (scatter m1 year, msymbol(diamond) mcolor(none) mlcolor(black)) ///
(scatter m2 year, msymbol(triangle) mcolor(none) mlcolor(black)) ///
(scatter m5 year, msymbol(triangle) mcolor(black)) ///
(scatter m6 year, msymbol(V) mcolor(black)) ///
(scatter m7 year, msymbol(X) msize(large) mcolor(black*0.7) ///
	 ytitle("Share") xtitle("Year") ylabel(0(0.1)1) ///
	graphregion(color(white)) plotregion(fcolor(white) lcolor(black))  ///
	legend(order(1 "Male" 2 "Age/100" 3 "Foreign" 4 "Education" 5 "Occupation")))

graph export 	


* %%%%%% Male, age and edlvl in the ads %%%%%
* %%%%%%%%% Figure A5 %%%%%%%%%%%%%

cap drop m1 m2 m3 m4 m5 m6 m7
bys year askermale anyforeignself: egen m1=mean(anystatusself_s)
bys year askermale anyforeignself: egen m2=mean(asker_age/100)  
bys year askermale anyforeignself: egen m3=mean(e1)
bys year askermale anyforeignself: egen m4=mean(e2)
bys year askermale anyforeignself: egen m5=mean(e3)
bys year askermale anyforeignself: egen m6=mean(e4)
bys year askermale anyforeignself: egen m7=mean(anyeducself)

tw (scatter m2 year if askermale==1 & anyforeignself==0, msymbol(diamond) mcolor(none) mlcolor(black)) ///
(scatter m1 year if askermale==1 & anyforeignself==0, msymbol(plus) mcolor(none) mlcolor(black)) ///
(scatter m3 year if askermale==1 & anyforeignself==0, msymbol(circle) mcolor(none) mlcolor(black)) ///
(scatter m4 year if askermale==1 & anyforeignself==0, msymbol(S) mcolor(none) mlcolor(black)) ///
(scatter m5 year if askermale==1 & anyforeignself==0, msymbol(triangle) mcolor(black)) ///
(scatter m6 year if askermale==1 & anyforeignself==0, msymbol(triangle) mcolor(none) mlcolor(black)) ///
(scatter m7 year if askermale==1 & anyforeignself==0, msymbol(X) msize(large) mcolor(black*0.7) ///
	 ytitle("Share") xtitle("Year") ylabel(0(0.1)1) ///
	graphregion(color(white)) plotregion(fcolor(white) lcolor(black))  ///
	legend(order(1 "Age/100" 2 "Status"  3 "LTC" 4 "College" 5 "PG" 6 "General Education" 7 " Any Education")))

graph export  	


* Female 
tw (scatter m2 year if askermale==0 & anyforeignself==0, msymbol(diamond) mcolor(none) mlcolor(black)) ///
(scatter m1 year if askermale==0 & anyforeignself==0, msymbol(plus) mcolor(none) mlcolor(black)) ///
(scatter m3 year if askermale==0 & anyforeignself==0, msymbol(circle) mcolor(none) mlcolor(black)) ///
(scatter m4 year if askermale==0 & anyforeignself==0, msymbol(S) mcolor(none) mlcolor(black)) ///
(scatter m5 year if askermale==0 & anyforeignself==0, msymbol(triangle) mcolor(black)) ///
(scatter m6 year if askermale==0 & anyforeignself==0, msymbol(triangle) mcolor(none) mlcolor(black)) ///
(scatter m7 year if askermale==0 & anyforeignself==0, msymbol(X) msize(large) mcolor(black*0.7) ///
	 ytitle("Share") xtitle("Year") ylabel(0(0.1)1) ///
	graphregion(color(white)) plotregion(fcolor(white) lcolor(black))  ///
	legend(order(1 "Age/100" 2 "Status"  3 "LTC" 4 "College" 5 "PG" 6 "General Education" 7 " Any Education")))

graph export  	


* %%%%% Summary stats table LFS %%%%%
* %%%%%%%%%% Table A1 %%%%%%%%%%%

use "LFS8401.dta", clear

* Overall 
estpost summarize Age e1 e2 e3 e4 e5 e6 Work2 WorkIncome if city~="" ///
& Age>=20 & Age<=50

esttab 

* Overall Single 
estpost summarize Age e1 e2 e3 e4 e5 e6 Work2 WorkIncome if city~="" & MaritalStat==1 ///
& Age>=16 & Age<=50

esttab 

*Male
estpost summarize Age e1 e2 e3 e4 e5 e6 Work2 WorkIncome if city~="" & MaritalStat==1 ///
& male==1 & Age>=20 & Age<=50

esttab 

* Female				 
estpost summarize Age e1 e2 e3 e4 e5 e6 Work2 WorkIncome if city~="" & MaritalStat==1 ///
& Age>=20 & Age<=50 & male==0

esttab 
				 


* %%%%%% Male, age and edlvl in the LFS %%%%%
* %%%%%%%%% Figure A5 %%%%%%%%%%%%%
tab edlvl, gen(d)
cap drop m2 m3 m4 m5 
bys year Sex MaritalStat: egen m2=mean(Age/100)  
bys year Sex MaritalStat: egen m3=mean(d1)
bys year Sex MaritalStat: egen m4=mean(d2)
bys year Sex MaritalStat: egen m5=mean(d3)
//bys year: egen m6=mean(anyeducself)


tw (scatter m2 year if Sex==1 & MaritalStat==1, msymbol(diamond) mcolor(none) mlcolor(black)) ///
(scatter m3 year if Sex==1 & MaritalStat==1, msymbol(circle) mcolor(none) mlcolor(black)) ///
(scatter m4 year if Sex==1 & MaritalStat==1, msymbol(square) mcolor(none) mlcolor(black)) ///
(scatter m5 year if Sex==1 & MaritalStat==1, msymbol(triangle) mcolor(black) ///
	 ytitle("Share") xtitle("Year") ylabel(0(0.1)1) ///
	graphregion(color(white)) plotregion(fcolor(white) lcolor(black))  ///
	legend(order(1 "Age/100" 2 "LTC" 3 "College" 4 "PG")))

graph export 	

* Female
tw (scatter m2 year if Sex==2 & MaritalStat==1, msymbol(diamond) mcolor(none) mlcolor(black)) ///
(scatter m3 year if Sex==2 & MaritalStat==1, msymbol(circle) mcolor(none) mlcolor(black)) ///
(scatter m4 year if Sex==2 & MaritalStat==1, msymbol(square) mcolor(none) mlcolor(black)) ///
(scatter m5 year if Sex==2 & MaritalStat==1, msymbol(triangle) mcolor(black) ///
	 ytitle("Share") xtitle("Year") ylabel(0(0.1)1) ///
	graphregion(color(white)) plotregion(fcolor(white) lcolor(black))  ///
	legend(order(1 "Age/100" 2 "LTC" 3 "College" 4 "PG")))

graph export 
